Skip to content

refactor(docker): build the runner image FROM devtools with no tool install - #6513

Merged
dan-petty merged 5 commits into
mainfrom
build/4361-runner-from-devtools
Nov 20, 2026
Merged

dan-petty merged 5 commits into
mainfrom
build/4361-runner-from-devtools

Conversation

@dan-petty

@dan-petty dan-petty commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

The runner image builds FROM the devtools image of .devcontainer/Dockerfile (tag and digest), which Renovate moves each week in the devtools group. The Dockerfile installs no tool: the gh download, the actionlint and runner-tools stages and each devops install-tools run go. The MCP server image builds on the Service image layers with kubectl and helm of devtools. The Service image copies gh and an OpenSpec tree that npm prune cuts from devtools. The runner smoke test checks only that openspec --version exits 0, so a devtools update does not wait for tools.lock. The project pin reaches a runner Job through #6517 after #6409. The runner scan reports with exit code 0, as SECURITY.md records; the Service and MCP server scans keep the gate. The runner size bound becomes 7000000000 bytes. Tests that read the removed Dockerfile lines go.

Closes #4361

Change: openspec/changes/archive/2026-11-20-4361-runner-from-devtools/

…nstall

The runner image builds FROM ghcr.io/dan-petty/devtools by tag and digest,
and the Dockerfile installs no tool: the gh download, the actionlint and
runner-tools stages and each devops install-tools run go. The MCP server
image builds on the Service image layers with kubectl and helm of devtools.
The Service image takes gh and a pruned OpenSpec tree from devtools.
The runner scan reports; the Service and MCP server scans keep the gate.

Closes #4361
@dan-petty dan-petty added type/refactor Type refactor: a new structure, same behavior scope/docker Docker and Podman commands and cleanup labels Nov 20, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Proof of the images (local, Podman 5.8.6, 2026-11-20)

Each command ran in a bash script under set -euo pipefail.

Build time and size

Image Before (origin/main) After (this branch)
runner 154 s, 2,421,606,454 bytes 53 s, 6,382,373,259 bytes
mcp-server 37 s (on the runner build), 2,982,428,221 bytes 88 s, 1,682,212,829 bytes
service 68 s (on the shared stages), 1,553,993,491 bytes 31 s, 1,554,003,201 bytes
  • Before: a cold build of the three targets in order, with the pulls of the Python, uv, Node and actionlint images in the time.
  • After: the devtools image was pulled first (80 s, 1.8 GB compressed, 4.88 GB on disk), so the runner time holds no pull. The lock stage was the same as before, so it came from the cache.
  • The runner grows by the about 30 tools of the devtools image. The size bound of the runner smoke test becomes 7,000,000,000 bytes; the MCP server keeps 3,000,000,000.

A change of src/ (build cache)

Two builds of each target that differ only in one line of src/devops_cli/__init__.py:

Image Rebuild Layers Changed layers
runner 10 s 15 1 (COPY --link of the project, 34.7 MB)
mcp-server 24 s 16 1
service 19 s 15 1

The old Dockerfile ran the OpenSpec install-tools step and the runner_tools build step again on such a change. Note: Podman keys a RUN --mount=type=bind,from=lock on the image of the lock stage, so a change of the project version also rebuilt the two venv layers locally. BuildKit keys a read-only bind mount with a source path on the content of the file, as for the old COPY --from=lock, so CI keeps them. The first CI run after the merge shows this in the cache report of the Runner Image job.

Smoke steps (the steps of ci.yml, with --tmpfs /home/devops:mode=1777)

All exit 0:

  • runner: id -u = 1000; devops --version; python -m devops_cli.roadmap.runner_tools = "All 40 runner tools are on PATH and run."; the probe with --read-only --tmpfs /tmp --tmpfs /home/devops:mode=1777 --cap-drop ALL --security-opt no-new-privileges; no gcc; uv run --locked ruff --version in a copy of the checkout on a read-only root (ruff 0.17.6, Python 3.14.10 of devtools).
  • mcp-server: id -u = 1000; devops --version; kubectl version --client (v1.37.2); helm version (v4.3.2); size under 3,000,000,000.
  • service: /healthz answers; gh 2.105.0; git 2.47.3; openspec --version = 2.1.1 on the official Node binary; the probe; no uv, no gcc, no pytest.

Trivy 0.76.2 (flags of .github/actions/image-scan)

Image Exit code Findings
mcp-server (gate, exit-code 1) 0 none (the 4 kubectl entries now name usr/local/bin/kubectl)
service (gate, exit-code 1) 0 none
runner (report, exit-code 0) 0 282 HIGH, 4 CRITICAL in 15 devtools binaries (k9s, kube-linter, popeye, gitleaks, gh-dash, minikube, kubeconform, kubectl-argo-rollouts, tofu, golangci-lint, kustomize, argo, cloudflared, pluto, promtool) and 1 in the semgrep venv of devtools (mcp 1.29.0). None in /app/.venv. Scan time 46 s.

git grep -n 'install-tools' -- Dockerfile prints nothing (exit 1).

@dan-petty

Copy link
Copy Markdown
Owner Author

Decisions for the owner to check

  1. Runner size bound: 3,000,000,000 to 7,000,000,000 bytes. This is a quality threshold, so it needs the owner. The devtools image alone is 4.88 GB, so the runner (6.38 GB measured) cannot stay under the old bound when it builds FROM devtools. The new bound is about 10% over the measured size, so a jump in the devtools image still fails the job. The MCP server bound stays at 3,000,000,000 (1.68 GB measured).
  2. The runner smoke test keeps python -m devops_cli.roadmap.runner_tools. Step 5 of the issue asked for <tool> --version lines. The module already runs the version command of each tool of RUNNER_TOOLS, holds no version (fix(roadmap): keep no tool versions in runner_tools.py #5585) and calls no install-tools. The spec requirement of the smoke test forbids a version command of its own in the workflow. Only -e DEVOPS_CLI_USER_DATA_ROOT=/opt/devops-tools goes. The MCP server smoke test runs kubectl version --client and helm version as the issue says.
  3. One report-only scan of the runner, not two. The issue body names a second gate scan that skips the devtools tools. The local scan put every finding under /usr/local/bin and /usr/local/lib/devtools, and none in /app/.venv, so such a gate would pass today. But /app/.venv is uv.lock, which the osv-scanner audit row already gates, and the owner text of the docs(security): when a control changes for a dev resource or sandbox #5447 entry names that row as the kept gate. A second scan of a 6 GB image would also need a skip-dirs input in the action. Say if you want it, and I add it.
  4. .trivyignore.yaml. The 4 kubectl entries move to usr/local/bin/kubectl (the MCP server gate reads them; the scan passes). The 11 entries of tofu, promtool, Trivy and actionlint go: only the runner scan read them, and it no longer gates, so they would only hide findings from the report.
  5. MCP server tools. The served job roles (src/devops_cli/ai/mcp/roles.py) run devops commands in-process. These start gh (GitHub reads), kubectl and helm (cluster reads). The image builds on service-deps, so it also holds git, Node and OpenSpec, and it shares those layers with the Service image. It no longer holds uv, the dev dependencies, actionlint, promtool, Trivy, OpenTofu, shellcheck, jq or curl, which no served tool starts. k8s audit starts popeye, which the old image did not hold either.
  6. OpenSpec in the Service image. The npm tree of devtools holds OpenSpec with Claude Code, Copilot, the Dev Containers CLI and Style Dictionary (658 MB). Stage openspec keeps only OpenSpec in package.json and runs npm prune --offline --ignore-scripts: 23 MB, openspec --version 2.1.1, no network. The official Node binary runs it.
  7. RUNNER_TOOLS. ToolSource names devtools in place of apt, tools-lock and image-pin (chore(tools): remove devops install-tools and tools.lock #4363 asked to rename tools-lock; this pull request does it, because the source changes here). kubectl, kube-linter, osv-scanner, npm, zsh and ps move from NOT_IN_RUNNER to RUNNER_TOOLS: a source of the gate needs each of them, and the image now holds them. The reasons in NOT_IN_RUNNER no longer say that the image lacks a program.
  8. Deleted tests (owner rule of 2026-11-16). The gh floor tests and the kubectl and helm floor test, as the issue names, and the tests that read the Dockerfile lines that this change removes: test_image_layers.py, the runner stage tests of test_runner_image.py and test_runner_hooks.py, the MCP server stage test, and the two Dockerfile tests of test_roadmap_runner_tools.py. No new test reads a config file. The counts of config_reads.toml fall with them.

Overlap with open pull requests

After the merge

Name uv.lock as the source of the dev dependency versions in CLUSTER.md
and runner_tools.py.
@dan-petty

Copy link
Copy Markdown
Owner Author

CI result on 65f5285

All 29 checks pass, 7 skip. The Service and MCP Server scans gate with exit code 1 and find nothing. The Runner scan runs with exit code 0: it reports 282 HIGH and 4 CRITICAL findings in 15 devtools binaries and 1 in the semgrep venv of devtools, and it uploads the SARIF under trivy-image-runner ("Successfully uploaded results"). The code scanning check Trivy passes. The runner tool check prints "All 40 runner tools are on PATH and run."

Image job times

Job Before (#6509, warm cache) This PR, run 1 (c44f27e) This PR, run 2 (65f5285)
Service Image 1:43 2:47 2:44
Runner Image 2:44 4:15 6:27
MCP Server Image 2:44 4:35 3:55

Both runs of this PR had no cache for the new stages, because the cache of main holds only the old stages. The steps of the Runner Image job:

Step Run 1 Run 2
Pull of the devtools image (1.8 GB) 25 s 37 s
Runtime venv / dev venv / project 22 s / 4 s / 2 s 29 s / 7 s / 3 s
Export of the 6.4 GB image into Docker (load: true) 69 s 112 s
Smoke test 25 s 33 s
Trivy scan 67 s 96 s

The export and the scan of the larger image take most of the time, and the time of these two steps changes with the runner. A later cache from main saves only the venv steps (about 30 s). The two runs give a mean of 5:21, under the limit of 5 min + 1 min tolerance, but run 2 was over 6 min. #4649 measures the image jobs again after this change. If the mean of the Runner Image job goes over 6 min, that is a P0 under AGENTS.md rule 5.

….lock

The runner uses the devtools digest of .devcontainer/Dockerfile, which
holds OpenSpec 2.1.0. The runner smoke test runs the OpenSpec gate in the
image, and the OpenSpec pin moves in the Renovate devtools group.
SECURITY.md states the real exposure of the Job pod and a review date, and
the documents say that the runner follows the devtools image each week.
@dan-petty

Copy link
Copy Markdown
Owner Author

Owner decisions of 2026-11-20

Recorded here and in the design.md of the change:

  • Image size: "don't worry about image size right now, thats an optimization for when we have something that works". The runner bound of 7,000,000,000 bytes is approved.
  • Scan: one report-only runner scan is accepted, because the images built FROM devtools are report-only (decision of 2026-11-19). The Runner Image job stays as it is, and this change does not optimize its time.
  • Dev dependencies: they leave the image in the follow-up build(runner): bootstrap the dev env with uv in each Job #6517, which also adds a uv command that bootstraps the coder environment. This pull request keeps the dev group.

Review findings: what changed

  1. OpenSpec split (blocker). The runner now uses the devtools digest of .devcontainer/Dockerfile (20261119@sha256:a7b2f111…). That image holds OpenSpec 2.1.0, the version of tools.lock, and the same versions and paths of the other tools. I did not move tools.lock to 2.1.1, for these reasons:

    • With 2.1.1, openspec validate --all --strict warns on MODIFIED requirements over 500 characters. Three active plans fail it: 3060 (549), 3391 (577) and 3429 (935).
    • Those plans belong to their items, and 3429 needs a split.
    • The regeneration with 2.1.1 changed no skill.
    • The 2.1.1 Renovate pull request fix(deps): update @fission-ai/openspec to v2.1.1 #6485 failed Static Analysis and the test jobs and closed with no merge.

    The OpenSpec rule of renovate.json is now in the devtools group, so the pin moves each week with the image that holds it. The runner smoke step of ci.yml and release.yml now runs uv run --locked devops ci --check --only openspec in the copy of the checkout in the image, with --tmpfs /tmp. Proof on the local runner image:

    • Image OpenSpec 2.1.0: exit 0 (row 38 s).
    • OpenSpec 2.1.1 first on PATH: exit 1, with "The openspec command at /ostools/node_modules/.bin/openspec prints 2.1.1, and the tools lock pins 2.1.0".

    For the owner: the OpenSpec rule loses schedule: at any time (build(openspec): move OpenSpec to 2.0.0 and its skill layout #5078). The runner can take a new OpenSpec only from a new devtools image, so OpenSpec now moves on the weekly schedule of the group. A follow-up must move tools.lock and devtools to 2.1.1 and fix the three plans.

  2. SECURITY.md exposure. Both rows now state that the Job pod loads every key of the Secret devops-cli with envFrom, the GitHub App private key and the gateway key included. Only the code of the Job limits its GitHub token to one repository. fix(k8s): load only the needed Secret keys in runner Jobs #6518 is the follow-up.

  3. Cadence. The Dockerfile comment, SECURITY.md and CLUSTER.md now say that the devtools image runs apt-get upgrade of sid in its own build, and that the runner follows that image each week through Renovate. The devtools group keeps the weekly schedule.

  4. Review date. Row 2 now has the review date 2026-12-20.

  5. ROADMAP_WORKFLOW.md describes the devtools runner: npm and osv-scanner for the audit row, and the report-only scan.

  6. roadmap-service-deployment: a MODIFIED delta for "The Service image runs the pinned OpenSpec" (the openspec stage of devtools, the official Node binary).

  7. devcontainer-image-tools: a MODIFIED delta for "OpenTofu is a pinned tool". The runner takes tofu from devtools; only the CI test job uses tools.lock. A third delta, release-concurrency-and-renovate, states that the devtools group holds the OpenSpec pin.

  8. Stale texts: _NO_CLUSTER, tests/conftest.py, tests/invariants/test_hermetic_floor.py and src/devops_cli/k8s/volume_move_measure.py now give the true cause. The causes are no cluster token (ADR 0007 for the tests) and a pod that cannot run a container engine (no capability, read-only root).

  9. Deleted test: test_the_tool_version_check_fails_on_mismatch_and_names_the_tool, which tested only a fake of the removed install-tools --check step.

@dan-petty

dan-petty commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner Author

Superseded later on 2026-11-20. The owner direction: make no circular dependency with devtools image updates, and do not anticipate upstream changes. This PR therefore leaves the OpenSpec Renovate rule as main has it, and its runner smoke step no longer compares the OpenSpec of the image with tools.lock.

Owner decision (2026-11-20): the OpenSpec Renovate rule moves weekly with the devtools group (it no longer runs "at any time" as #5078 set), because the runner can get a new OpenSpec only from a new devtools image. Accepted as recommended.

The runner smoke test no longer runs the OpenSpec gate in the image, so a
devtools update does not need a move of tools.lock, and a move of
tools.lock does not need a devtools update. The OpenSpec rule of Renovate
is the rule of main again. The runner uses the OpenSpec of its devtools
image, and the OpenSpec pin of the project reaches a runner Job through
the coder bootstrap (#6517) after #6409. The documents and the change say
so.
#6409 moves the OpenSpec pin from tools.lock to the project, so
docs/CLUSTER.md and docs/SDLC.md name the pin of the project, as the
Dockerfile and the design do.
@dan-petty
dan-petty marked this pull request as ready for review November 20, 2026 15:40
@dan-petty
dan-petty merged commit a165aaa into main Nov 20, 2026
36 checks passed
@dan-petty
dan-petty deleted the build/4361-runner-from-devtools branch November 20, 2026 15:43
dan-petty pushed a commit that referenced this pull request Nov 20, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.183.0](v0.182.3...v0.183.0)
(2026-11-20)


### Features

* **research:** Map a pinned Action commit to its release
([#6490](#6490))
([d27abc8](d27abc8))


### Bug Fixes

* **roadmap:** Name a dependency cycle in the roadmap jobs
([#6505](#6505))
([494de4f](494de4f))
* **roadmap:** Read only blockers under Dependencies
([#6514](#6514))
([59fc325](59fc325))


### Code Refactoring

* **docker:** build the runner image FROM devtools with no tool install
([#6513](#6513))
([a165aaa](a165aaa)),
closes [#4361](#4361)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
dan-petty added a commit that referenced this pull request Nov 21, 2026
… the ADR (#3827)

The runner image builds FROM the devtools image since #6513, and that image holds Gitleaks,
Pluto, golangci-lint and Semgrep. So the scanners are RUNNER_TOOLS entries of the source
DEVTOOLS and the Dockerfile gets no pin. ADR 0030 is taken, so the record is 0031. SECURITY.md
states the runner exception.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/docker Docker and Podman commands and cleanup type/refactor Type refactor: a new structure, same behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build(docker): build the runner image FROM devtools with no tool install

1 participant